<?php
namespace App\Http\Controllers\Admin;

use App\Service\Admin\ActionService;
use Illuminate\Http\Request;

class ActionController extends BaseController
{
    //登录

    //获取权限
    public function index(Request $request)
    {
//        $uid = $request->post('uid', 0);
        $res = ActionService::index();
        if ($res['code'] < 0) {
            return self::toJson(-2, $res['msg']);
        }
        return self::toJson(0, '', $res['data']);
    }

    //修改
    public function modify(Request $request)
    {
        $id = $request->post('id', 0);
        $title = $request->post('title', '');
        $res = ActionService::modify($id, $title);
        if ($res['code'] < 0) {
            return self::toJson(-2, $res['msg']);
        }
        return self::toJson();
    }
}